<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>flex</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        .content {
            width: 900px;
            height: 500px;
            background-color: #ccc;
            margin: 0 auto;
            /* 设置父容器为伸缩布局, 子元素会自动变成伸缩项 */
            display: flex;
        }
        .first {
            height: 100%;
            background-color: red;
            /* flex
                1. 是flex-grow, flex-shrink, flex-basis的简写，默认为0 1 auto(后两个属性可选)
                2. 设置父元素分页比例，计算值仍为当前子元素设置的flex值 / 总子元素的flex值总和
                3. 拿到比例后，页面自动计算宽度/高度
             */
            flex: 1;
        }
        .second {
            height: 100%;
            background-color: green;
            flex: 4;
        }
    </style>
</head>
<body>
    <div class="content">
        <div class="first">1</div>
        <div class="second">2</div>
    </div>
</body>
</html>